﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SignalLab
{
  public partial class SaveToCategory : UserControl
  {
    public SaveToCategory()
    {
      InitializeComponent();
      lbx.ItemsSource = AppManager.Instance.Categories;
    }

    private void lbx_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      var item = e.AddedItems.OfType<string>().FirstOrDefault();
      if (item == null) return;
      Category = item;
      lbx.SelectedIndex = -1;
      App.CloseOverlay();
    }

    public string Category;

    private void cancelBtn_Click(object sender, RoutedEventArgs e)
    {
      Category = null;
      App.CloseOverlay();
    }
  }
}
